<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./node_modules/vue/dist/vue.js"></script>
</head>
<body>
   
    <input type="text">
    <script>      //vm,实例化vue,
        let obj={};
        let temp='';
        let ipt=document.querySelector('input');
        console.log(ipt);
        
        ipt.oninput=function(){
            obj.age=this.value
        }
        Object.defineProperty(obj,'age',{
            set:function(val){
                console.log('调用了set:'+val);
                temp=val
            },
            get:function(){
                console.log('调用了get');
                return temp
            }
        })
    </script>
</body>
</html>